import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import {addition,subtraction} from '@/store/modules/counter'
export default function Counter() {  
  const count=useSelector((state)=>{
    return state.counter.count
  })
  const dispatch=useDispatch()
  const increment=()=>{
    dispatch(addition(5))
  }
  const jian=()=>{
    dispatch(subtraction(3))
  }
  return (
    <div>
        <h2>{count}</h2>
        <button onClick={increment}>+</button>
        <button onClick={jian}>-</button>
    </div>
  )
}
